package com.sdgakj.entity;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;//
import java.util.Date;//
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.google.common.collect.ImmutableList;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.validator.constraints.NotBlank;


@Entity
@Table(name = "f_order")
public class Order extends IdEntity {
	
	private static final long serialVersionUID = 1L;
	
    /** 操作*/
    private Long userId;
    /** 认证电话 */
    private String authTel;
	/** 支付总额 */
	private Double amount;
    /** 支付id **/
    private OrderPay orderPay;
    /**
     * 原有状态：1、未支付 3、待审核 4、role1待审核role2已指派 5、已完成 6、已关闭 原有待审核、已指派状态改为付款完成状态
     * ，取消按角色判断状态 1、等待付款 2、付款完成 3、交易完成 4、订单取消 5、退款审核中 6、退款中 7、退款完成 8已打款
     */
    private Integer isPay;

    public Integer getIsPay() {
        return isPay;
    }

    public void setIsPay(Integer isPay) {
        this.isPay = isPay;
    }

    private Integer state;
    /** 创建时间 */
    private Date createtime;

    private Date updatetime;

    /** 交易完成(打款)时间O */
    private Date completeTime;
	/** 乐观*/
	private Integer versionNum;
    /** 已捐赠数*/
    private  Integer realNum;
    /** 目标捐赠数*/
    private Integer targetNum;
    /** 订单名称 */
    private String title;
    /** 订单描述 */
    private String oDesp;

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    @ManyToOne
    @JoinColumn(name = "pay_id")
    public OrderPay getOrderPay() {
        return orderPay;
    }

    public void setOrderPay(OrderPay orderPay) {
        this.orderPay = orderPay;
    }

	public Double getAmount() {
		return amount;
	}
	public void setAmount(Double amount) {
		this.amount = amount;
	}
	
    public String getAuthTel() {
        return authTel;
    }

    public void setAuthTel(String authTel) {
        this.authTel = authTel;
    }

	public Integer getState() {
		return state;
	}
	public void setState(Integer state) {
		this.state = state;
	}

    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    public Date getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(Date updatetime) {
        this.updatetime = updatetime;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getCompleteTime() {
        return completeTime;
    }

    public void setCompleteTime(Date completeTime) {
        this.completeTime = completeTime;
    }

    public Integer getRealNum() {
        return realNum;
    }

    public void setRealNum(Integer realNum) {
        this.realNum = realNum;
    }

    public Integer getTargetNum() {
        return targetNum;
    }

    public void setTargetNum(Integer targetNum) {
        this.targetNum = targetNum;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getoDesp() {
        return oDesp;
    }

    public void setoDesp(String oDesp) {
        this.oDesp = oDesp;
    }

    @Version
	public Integer getVersionNum() {
		return versionNum;
	}
	public void setVersionNum(Integer versionNum) {
		this.versionNum = versionNum;
	}
	
}
